libxc: logger: add newline when progress is complete
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Sep 2010 17:41:37 +0000 (18:41 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Sep 2010 17:41:37 +0000 (18:41 +0100)
In xc_domain_save ensure that we signal completion at the end of each
batch.

This ensures that the next logged line starts on a new line. e.g. instead of:
     Savefile contains xl domain config
    xc: Saving memory: iter 3 (last sent 0 skipped 0): 0/32768    0%migration target: Transfer complete, requesting permission to start domain.
    migration sender: Target has acknowledged transfer.
what is desired is:
     Savefile contains xl domain config
    xc: Saving memory: iter 0 (last sent 0 skipped 0): 32768/32768  100%
    xc: Saving memory: iter 1 (last sent 32576 skipped 192): 32768/32768  100%
    xc: Saving memory: iter 2 (last sent 217 skipped 0): 32768/32768  100%
    xc: Saving memory: iter 3 (last sent 0 skipped 0): 32768/32768  100%
    migration target: Transfer complete, requesting permission to start domain.
    migration sender: Target has acknowledged transfer.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_domain_save.c
tools/libxc/xtl_logger_stdio.c

index b9273bb3aef5dcc37714aa9209ef471452343a12..ef33fa11344a0bff6878d3784cbb2d98d61ef1f1 100644 (file)
@@ -1461,6 +1461,8 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter
 
       skip:
 
+        xc_report_progress_step(xch, dinfo->p2m_size, dinfo->p2m_size);
+
         total_sent += sent_this_iter;
 
         if ( last_iter )
index de0935ac47d1de01efd23e1277ed5e15b907509a..3edf0a2fd720ee534c31b4db991d22870386a5b4 100644 (file)
@@ -108,9 +108,12 @@ static void stdiostream_progress(struct xentoollog_logger *logger_in,
     if (lg->progress_erase_len)
         putc('\r', lg->f);
 
-    newpel = fprintf(lg->f, "%s%s" "%s: %lu/%lu  %3d%%",
+    lg->progress_last_percent = percent;
+
+    newpel = fprintf(lg->f, "%s%s" "%s: %lu/%lu  %3d%%%s",
                      context?context:"", context?": ":"",
-                     doing_what, done, total, percent);
+                     doing_what, done, total, percent,
+                    done == total ? "\n" : "");
 
     extra_erase = lg->progress_erase_len - newpel;
     if (extra_erase > 0)